/**
 * FormFieldTreeRadio
 * zTree API官网：https://treejs.cn/v3/api.php
 */
layui.define(['FormFieldTreeCheck'], function (exports) {

    let FormFieldTreeCheck = layui.FormFieldTreeCheck;

    class FormFieldTreeRadio extends FormFieldTreeCheck {

        constructor(options = {}) {
            super(options);
            this.mode = "radio";
        }

        defineExtraArgs() {
            return {
                nodes: [],
                closeLevel: 0,
                lastChecked: false,
            };
        }

        handleArgs(args) {
            let that = this;
            // nodes
            that.handleArgsByNodes(args);
            // verify
            if (args.verify.indexOf("in") === -1)
                args.verify += (args.verify ? "|" : "") + `in:${that.getArgsAllowNodeIds(args).join(",")}`;
            return args;
        }
        
    }

    exports('FormFieldTreeRadio', FormFieldTreeRadio);
});